#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>

// 内存写入磁盘中
int main()
{
    const char * filename = "./record.txt";
    int fd = open(filename,O_CREAT | O_RDWR,0644);
    if (fd == -1)
    {
        perror("open error:");
        exit(-1);
    }
    printf("fd = %d\n", fd);

    const char * buffer = "helloworld";
    int writeBytes = write(fd,(void*)buffer,strlen(buffer));
    printf("%d\n",writeBytes);

    close(fd);
    
    return 0;
}
